/*
 * EnemyFactory.java
 *
 * Created on 18. Mai 2007, 12:15
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package de.tor.obj.impl;

import com.golden.gamedev.object.sprite.VolatileSprite;
import de.tor.loaders.Level;
import de.tor.obj.Enemy;
import de.tor.obj.action.impl.LinearMovement;

/**
 *
 * @author Charon
 */
public class EnemyFactory {
    
    public final static int ASTEROID1 = 0;
    public final static int ASTEROID2 = 1;
    public final static int ASTEROID3 = 2;
    public static final int GUN1 = 3;
    public static final int GUN2 = 4;
        public static final int GUN3 = 5;
    private static Level mOwner = null;
    
    public static void init(Level pOwner){
        mOwner = pOwner;
    }
    
    public static Enemy factorEnemy(int type){
        switch(type){
            case ASTEROID1:{
                Asteroid ast = new Asteroid(mOwner, mOwner.getImages("resources/asteroid2.png", 13,1,true));
                ast.setDestructionAnimation(new VolatileSprite(mOwner.getImages("resources/asteroid1_dest.png", 7,1,true), 0,0));
                LinearMovement lm = new LinearMovement(0, 0, 0);
                ast.setMovement(lm);
                return ast;
            }case ASTEROID2:{
                Asteroid ast = new Asteroid(mOwner, mOwner.getImages("resources/asteroid3.png", 6,1,true));
                ast.setDestructionAnimation(new VolatileSprite(mOwner.getImages("resources/asteroid1_dest.png", 7,1,true), 0,0));
                LinearMovement lm = new LinearMovement(0, 0, 0);
                ast.setMovement(lm);
                return ast;
            }case ASTEROID3:{
                Asteroid ast = new Asteroid(mOwner, mOwner.getImages("resources/asteroid1.png", 15,1,true));
                ast.setDestructionAnimation(new VolatileSprite(mOwner.getImages("resources/asteroid1_dest.png", 7,1,true), 0,0));
                LinearMovement lm = new LinearMovement(0, 0, 0);
                ast.setMovement(lm);
                return ast;
            }case GUN1:{
                WorldEnemy gun = new WorldEnemy(mOwner, mOwner.getImage("resources/levels/gun1.png", true));
                gun.setDestructable(true);
                gun.setHealth(5000);
                gun.setCollisionDamage(1000);
                GatlingGun w1 = new GatlingGun(gun);
                w1.setObjectRelativePosition(-15, 59);
                w1.setShotsPerSecond(10);
                gun.addWeapon(w1);
                GatlingGun w2 = new GatlingGun(gun);
                w2.setObjectRelativePosition(12, 59);
                w2.setShotsPerSecond(10);
                gun.addWeapon(w2);
                gun.setShoothing(true);
                gun.setLayer(10);
                return gun;
            }case GUN2:{
                WorldEnemy gun = new WorldEnemy(mOwner, mOwner.getImage("resources/levels/gun2.png", true));
                gun.setDestructable(true);
                gun.setHealth(5000);
                gun.setCollisionDamage(1000);
                GatlingGun w1 = new GatlingGun(gun);
                w1.setObjectRelativePosition(-13, 50);
                w1.setShotsPerSecond(10);
                gun.addWeapon(w1);
                GatlingGun w2 = new GatlingGun(gun);
                w2.setObjectRelativePosition(13, 50);
                w2.setShotsPerSecond(10);
                gun.addWeapon(w2);
                gun.setShoothing(true);
                gun.setLayer(10);
                return gun;
            }case GUN3:{
                WorldEnemy gun = new WorldEnemy(mOwner, mOwner.getImage("resources/levels/gun3.png", true));
                gun.setDestructable(true);
                gun.setHealth(5000);
                gun.setCollisionDamage(1000);
                GatlingGun w1 = new GatlingGun(gun);
                w1.setObjectRelativePosition(0, 64);
                w1.setShotsPerSecond(10);
                gun.addWeapon(w1);
               
                gun.setLayer(10);
                return gun;
            }
            default:{
                return null;
            }
        }
    }
}
